<template>
	<view class="pop-recharge">
		<view class="pop-recharge-head">
			<view class="left">充值</view>
			<view class="right">
				余额：{{ balance }}
				<view class="icon iconfont icon-shuaxin"></view>
			</view>
		</view>
		<view class="pop-recharge-list">
			<block v-for="(coin, index) in coinData" :key="'coin' + index">
				<view class="pop-recharge-item">
					<view class="coin-info">
						<image src="../../static/wallet/coin.png" mode="aspectFill"></image>
						<view>{{ coin.coin|format }} 狐狸币</view>
					</view>
					<view @tap="doRecharge(coin.id)" class="recharge-price">￥{{ coin.fee|format }}</view>
				</view>
			</block>
		</view>
	</view>
</template>

<script>
export default {
	props: {
		balance: Number,
		coinData: Array
	},
	methods: {
		doRecharge(id){
			if(id){
				this.$emit("doRecharge",id);
			}
		},
	},
	filters:{
		format(val){
			return val.replace('.00','');
		}
	}
};
</script>

<style lang="less" scoped>
.pop-recharge {
	width: 100%;

	.pop-recharge-head {
		padding: 20rpx 40rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		border-top-left-radius: 30rpx;
		border-top-right-radius: 30rpx;
		background-color: #ffffff;
		border-bottom: 1rpx solid #eeeeee;
		.left,
		.right {
			font-size: 28rpx;
			color: #2b1c00;
		}
		.left {
			font-weight: 500;
		}
		.right {
			font-weight: 400;
			display: flex;
			flex-direction: row;
			align-items: center;
			.icon-shuaxin::before {
				color: #f86090;
				font-size: 28rpx;
				margin-left: 15rpx;
			}
		}
	}

	.pop-recharge-list {
		background-color: #ffffff;
		padding-bottom: 40rpx;
	}
	.pop-recharge-item {
		padding: 20rpx 30rpx 20rpx 40rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		border-bottom: 1rpx solid #eeeeee;
		.coin-info {
			display: flex;
			flex-direction: row;
			align-items: center;
			image {
				vertical-align: middle;
				width: 50rpx;
				height: 50rpx;
				margin-right: 10rpx;
			}
			view {
				color: #2b1c00;
				font-size: 28rpx;
			}
		}
		.recharge-price {
			text-align: center;
			width: 130rpx;
			background: linear-gradient(270deg, #fc80a4 0%, #feb7ba 100%);
			border-radius: 20rpx;
			font-size: 28rpx;
			font-weight: 500;
			color: #ffffff;
		}
	}
}
</style>
